<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../application/css/animate.css">
    <script src="../application/vue.js"></script>
    <style>
        *{
            padding:0px;
            margin:0px;
        }
        .div1{
            background-color:aqua;
            position:absolute;
            width:100%;
            height:100px;
            font-size:30px;
            text-align:center;
            line-height:100px;
            border-radius:50%;
            color:white;
            font-weight:bold;
        }
        .div2{
            background-color:chartreuse;
            position:absolute;
            width:100%;
            height:100px;
            font-size:30px;
            text-align:center;
            line-height:100px;
            border-radius:50%;
            color:white;
            font-weight:bold;
        }
        .div{
            height:120px;
        }
    </style>
</head>
<body>
    <div id="app">
        <input type="button" value="切换" @click="flag=!flag">
        <hr>
        <transition-group enter-active-class="animated zoomInUp"
            leave-active-class="animated zoomOutDown"
        >
            <div class="div1" v-if="flag" key="group1">但愿人长久</div>
            <div class="div2" v-if="!flag" key="group2">千里共婵娟</div>
        </transition-group>
        <div class="div"></div>
        <hr>
        <transition-group 
            enter-active-class="animated zoomInUp"
            leave-active-class="animated zoomOutDown"
        >
            <p v-for="(value,index) in arr" :key="value">{{value}}</p>
        </transition-group>
        <input type="button" value="添加数组值" @click="arr.push(Math.random())">
    </div>
</body>
<script>
    new Vue({
        el:"#app",
        data:{
            flag:true,
            arr:[]
        }
    })
</script>
</html>